package Class_Object.接口;

interface Shape {
    //TODO 接口里面都是抽象方法,除了被static 或者default修饰的方法
    public static final int a = 3;
    //成员变量都是public static final
    void draw();//不需要public abstract修饰
}
class Rect implements Shape {

    @Override
    public void draw() {
        System.out.println("矩形");
    }
}
class Flower implements Shape {
    @Override
    public void draw() {
        System.out.println("❀");
    }
}

public class Test {
    public static void drawMap(Shape shape) {
        shape.draw();
    }

    public static void main(String[] args) {
        Shape shape = new Rect();
        Shape shape1 = new Flower();
        drawMap(shape);//多态
        drawMap(shape1);
        System.out.println("=========");
        Shape[] shapes = {new Rect(),new Flower()};
        for (Shape s : shapes) {
            s.draw();
        }
    }
}
